package fm.dongman.animefm.view.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.Objects;

import fm.dongman.animefm.R;

/**
 * 评论测试adapter
 * Created by Administrator on 2017/10/26.
 */

public class TestAdapter extends RecyclerView.Adapter<TestAdapter.ViewHolder>{
    private Context context; //上下文
    private String flag;    //标记
    private int sum;        //循环数量

    public TestAdapter(Context context,String flag,int sum)
    {
        this.context=context;
        this.flag=flag;
        this.sum=sum;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = null;
        if(Objects.equals(flag, "comment"))
        {
            view= LayoutInflater.from(context).inflate(R.layout.item_anime_details_comments,null);
        }else if(Objects.equals(flag, "chat"))
        {
            view=LayoutInflater.from(context).inflate(R.layout.item_chat_list,null);
        }else if(Objects.equals(flag, "article"))
        {
            view=LayoutInflater.from(context).inflate(R.layout.item_find_anime_sheet_special,null);
        }else if(Objects.equals(flag, "userinfo")){
            view=LayoutInflater.from(context).inflate(R.layout.item_find_anime_master,null);
        }

        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {

    }

    @Override
    public int getItemCount() {
        return sum;
    }

    class ViewHolder extends RecyclerView.ViewHolder {
        public ViewHolder(View itemView) {
            super(itemView);
        }
    }
}
